{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Итоговая работа"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import sympy\n",
    "\n",
    "from scipy.optimize import minimize\n",
    "from sklearn.decomposition import PCA\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Задание 1\n",
    "\n",
    "Дана матрица рейтингов фильмов (строки - пользователи (10 человек), столбцы - фильмы (15 фильмов))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "ratings = np.array([[ 4,  4,  9,  4,  1,  6, 10,  7,  9,  6,  9,  2,  8,  6,  6],\n",
    "                     [ 9,  2,  5, 10,  7,  8, 10,  5,  6,  2,  1,  6,  8,  9,  7],\n",
    "                     [ 1,  6,  8,  8,  4,  9,  3,  8, 10,  5,  2,  6,  8,  1,  6],\n",
    "                     [ 6,  1,  9,  7,  7,  9,  2,  3,  5,  1,  6,  6,  3,  2,  7],\n",
    "                     [ 3,  7,  3,  5,  7,  9,  9,  6,  2,  9,  1,  2,  8, 10,  6],\n",
    "                     [ 8,  3,  7,  3,  8,  6,  1,  8,  8,  6,  1,  9,  4, 10,  1],\n",
    "                     [ 9,  8,  4,  8,  8, 10,  6,  1,  1,  2,  9,  5,  2,  7,  2],\n",
    "                     [ 4,  1,  6,  4,  3, 10,  4,  4,  2,  8,  7,  9,  3,  8,  3],\n",
    "                     [ 2,  7,  7,  6, 10,  6,  8,  9,  8,  6, 10,  1,  7, 10,  4],\n",
    "                     [ 5, 10,  8,  8,  9,  7,  2,  9,  9, 10,  8,  8,  8,  6, 10]])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "a) Необходимо найти наиболее похожего пользователя по косинусной метрике для каждого из (ответ: 10 пар вида (x, y), где y - наиболее похожий пользователь на пользователя x)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def cosine_similarity(user, ratings):\n",
    "    \"\"\" Определяет наиболее похожего пользователя методом косинусного сходства\n",
    "    \n",
    "    Параметры\n",
    "    ---------\n",
    "    user : array-like\n",
    "      Вектор данных определенного пользователя\n",
    "    ratings : {array-like}\n",
    "      Матрица векторов всех пользователей без искомого\n",
    "      \n",
    "    Результат:\n",
    "      user_id, cosine: tuple\n",
    "      Номер строки из ratings для максимально похожего пользователя, косинусное расстояние между векторами \n",
    "    \"\"\"\n",
    "    \n",
    "    result = []\n",
    "    \n",
    "    for rating_user_id, rating_user_vektor in enumerate(ratings):\n",
    "        cosine = np.dot(rating_user_vektor, user) / (np.linalg.norm(rating_user_vektor) * np.linalg.norm(user))\n",
    "        result.append((rating_user_id, cosine))\n",
    "        \n",
    "    most_similar_user_id, most_similar_user_cosine  = sorted(result, key=lambda x: x[1], reverse=True)[0]\n",
    "        \n",
    "    return most_similar_user_id, most_similar_user_cosine"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[(0, 7), (1, 3), (2, 8), (3, 8), (4, 7), (5, 8), (6, 3), (7, 5), (8, 0), (9, 2)]\n"
     ]
    }
   ],
   "source": [
    "similar_pair = []\n",
    "for user_id, user_vektor in enumerate(ratings):\n",
    "    most_similar_user_id, most_similar_user_cosine = cosine_similarity(user=user_vektor, \n",
    "                                                                       ratings=np.delete(ratings, user_id, axis=0))\n",
    "    similar_pair.append((user_id, most_similar_user_id))\n",
    "print(similar_pair)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "b) Предположим, вы захотели сжать признаковые описания пользователя с 15 фильмов, до, скажем, 5-ти признаков, как вы это сделаете?\n",
    "\n",
    "Можно сжать с помощью алгоритма PCA."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "scaler = StandardScaler()\n",
    "scaler.fit(ratings)\n",
    "ratings_std = scaler.transform(ratings)\n",
    "\n",
    "pca = PCA(n_components=5)\n",
    "pca.fit(ratings_std)\n",
    "ratings_std_pca = pca.transform(ratings_std)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-2.23314118, -0.102165  ,  0.44797696,  2.61804741,  1.0095813 ],\n",
       "       [ 0.92243636,  0.81306507, -1.87510954, -0.58041712,  2.4045235 ],\n",
       "       [-1.67575359, -2.02879876, -1.16066737,  0.50380895, -0.71030389],\n",
       "       [ 1.67999615, -2.67145216, -0.99414903,  0.34709449,  0.31175136],\n",
       "       [-0.11513119,  3.07699788, -0.14533016,  0.48754373, -1.00058414],\n",
       "       [ 0.35464165, -0.64108618,  3.24099221, -1.77678483,  1.25848972],\n",
       "       [ 3.75882285,  1.04221289, -1.01919801, -0.47560766, -0.70545265],\n",
       "       [ 2.13598259, -0.57558425,  1.86176566,  1.29283165, -1.3613989 ],\n",
       "       [-2.1630807 ,  1.79347946,  0.38668074, -0.16732588,  0.20976016],\n",
       "       [-2.66477294, -0.70666895, -0.74296145, -2.24919074, -1.41636647]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratings_std_pca"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Задание 2\n",
    "\n",
    "Вычислите производную $f(x) = tg^2(sin(x) + cos(2x+3))$ в точке $x_0=1$ (на python и на бумаге)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "а) На бумаге\n",
    "\n",
    "$\n",
    "f(x)'= 2tg(sin(x) + cos(2x+3))*(tg(sin(x) + cos(2x+3)))' = \\\\\n",
    "2tg(sin(x) + cos(2x+3)) * \\frac{1}{cos^2(sin(x) + cos(2x+3))} * (sin(x) + cos(2x+3))' = \\\\\n",
    "2tg(sin(x) + cos(2x+3)) * \\frac{1}{cos^2(sin(x) + cos(2x+3))} * (cos(x) - 2sin(2x+3)) =\\\\\n",
    "2tg(sin(x) + cos(2x+3)) * (tg^2(sin(x) + cos(2x+3))+1) * (cos(x) - 2sin(2x+3))\n",
    "$\n",
    "\n",
    "Для x = 1\n",
    "\n",
    "$2tg(sin(1) + cos(5)) * (tg^2(sin(1) + cos(5))+1) * (cos(1) - 2sin(5)) = \\\\\n",
    "2tg(0,84147 + 0,28366) * (tg^2(0,84147 + 0,28366)+1) * (0,54030 - (-1,91785)) = \\\\\n",
    "4,18654 * 5,38178 * 2,45815 = 55,38466$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2) Реализация в python "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\tan^{2}{\\left(\\sin{\\left(x \\right)} + \\cos{\\left(2 x + 3 \\right)} \\right)}$"
      ],
      "text/plain": [
       "tan(sin(x) + cos(2*x + 3))**2"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = sympy.symbols('x')\n",
    "fx = sympy.tan(sympy.sin(x) + sympy.cos(2*x + 3))**2\n",
    "fx"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Первая производная функции:\n"
     ]
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 \\left(- 2 \\sin{\\left(2 x + 3 \\right)} + \\cos{\\left(x \\right)}\\right) \\left(\\tan^{2}{\\left(\\sin{\\left(x \\right)} + \\cos{\\left(2 x + 3 \\right)} \\right)} + 1\\right) \\tan{\\left(\\sin{\\left(x \\right)} + \\cos{\\left(2 x + 3 \\right)} \\right)}$"
      ],
      "text/plain": [
       "2*(-2*sin(2*x + 3) + cos(x))*(tan(sin(x) + cos(2*x + 3))**2 + 1)*tan(sin(x) + cos(2*x + 3))"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print('Первая производная функции:')\n",
    "sympy.diff(fx, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Значение производной в точке x=1:\n"
     ]
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 55.3859176353379$"
      ],
      "text/plain": [
       "55.3859176353379"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print('Значение производной в точке x=1:')\n",
    "sympy.diff(fx, x).evalf(subs={x: 1})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Задание 3\n",
    "\n",
    "Дана функция с неизвестными параметрами a и b, вам также известны значения функции fx в точках x. Найдите оптимальные параметры a, b, минимизирующие абсолютную ошибку error."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAD4CAYAAAAJmJb0AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAxiUlEQVR4nO3deXyU15Xg/d+tKu37jhZACO1sAgO22czqFdvYHSfuTCdOO/26+03SiTs9nYmnJ5k3mU6P32Q64yTdSdrpJJ10Z2I78QLGxBgQxhLYZl8lgUoIkIS20r5LVXXnj5Lc2BYgpKp6qp4638+HD1rrOUKqw9V5zj1Xaa0RQghhThajAxBCCOE7kuSFEMLEJMkLIYSJSZIXQggTkyQvhBAmZjM6gGulpqbq3Nxco8M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6mNGxGGC11noZcB/wxfGSrFeYIcnL7PoQMV6Xfhn4jdb6FaPj8SetdTfwNp4zk81qNfDQeH36BWCjUurfjQ3JP7TWV8f/bgNexYvHpZohyR8BCpRS85RS4XgOEN9hcEzCy8ZvQv4cqNZaf9/oePxBKZWmlEocfzkK2AzUGBqUD2mtn9Fa52itc/E8j8u11n9icFg+p5SKGW8mQCkVA9wNeK1zLuiT/PhB4l8CduO5GfeS1vqcsVH5llLqt8C7QJFSqlEp9XmjY/KD1cBn8KzuTo7/ud/ooHwsE9ivlDqNZzGzR2sdMm2FISQDqFRKncJzuNIbWus3vfXgQd9CKYQQ4vqCfiUvhBDi+iTJCyGEiUmSF0IIE5MkL4QQJiZJXgghTEySvBBCmJgkeSGEMLH/C1fyN8J9L/vWAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def f(x, a, b):\n",
    "    return np.e**a * np.sin(b*x) + x\n",
    "\n",
    "def error(params):\n",
    "    return np.sum(np.abs(fx - f(x, params[0], params[1])))\n",
    "\n",
    "x = np.array([0.        , 0.26315789, 0.52631579, 0.78947368, 1.05263158,\n",
    "              1.31578947, 1.57894737, 1.84210526, 2.10526316, 2.36842105,\n",
    "              2.63157895, 2.89473684, 3.15789474, 3.42105263, 3.68421053,\n",
    "              3.94736842, 4.21052632, 4.47368421, 4.73684211, 5.        ])\n",
    "\n",
    "fx = np.array([  0.        , -12.01819092, -18.90968634, -17.68786571,\n",
    "                -8.7529108 ,   4.27524517,  16.06801336,  21.81250213,\n",
    "                19.22059845,   9.48411207,  -3.22273056, -13.48576488,\n",
    "               -16.91096359, -11.95866834,  -0.58630088,  12.56873816,\n",
    "                22.12489421,  24.20292139,  18.04522521,   6.33211092])\n",
    "\n",
    "plt.plot(x, fx)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Optimization terminated successfully.\n",
      "         Current function value: 234.951035\n",
      "         Iterations: 3404\n",
      "         Function evaluations: 5947\n",
      "Найден минимум функции ошибок 234.9510347189497 в точке a=4.863222471245271, b=0.016885718925033908\n"
     ]
    }
   ],
   "source": [
    "result = minimize(error, [0,0], method='Nelder-Mead', options={'disp': True, 'maxiter': 10000})\n",
    "print(f'Найден минимум функции ошибок {result.fun} в точке a={result.x[0]}, b={result.x[1]}')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Задание 4¶\n",
    "\n",
    "Создайте собственную дискретную случайную величину с 20 значениями. Сгенерируйте 1000 выборок размера 50. Посчитайте среднее для каждой выборки. Постройте гистограмму распределения средних."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEXCAYAAABWNASkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAaxUlEQVR4nO3de7hcVZ3m8e9LgIAkCDEnMeR2GI0XcCRADPIwoygMIDAT9BEmDEIUNNANbTODtgGxRSUabPHS2qjILbQgpKWRGBiuPUjzKGCC3EKIBjiQkEDCRUmkDST5zR9rHbJTqTqnzqVyyMr7eZ7zVNXae+291t5Vb+1atWsfRQRmZlaW7Qa6AWZm1v8c7mZmBXK4m5kVyOFuZlYgh7uZWYEc7mZmBXK4m5kNAEl7STpS0iBJUyXt0Z/L3yrDXVKHpP+QtKby96WBbpeZWQ+sAs4FngdOAl7sz4Vra/wRk6QO4NMRcftAt8XM7A0pIra6P6ADOLTBtCuA8yuPbwIC2D4/HgZcDiwHXgJ+kcv/CKwB/gKsz/fXACcA7XkZ03O9FcBZlXUMBr6bpy3P9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71hR/ISJuGYj2mLWSh2XMzArkYRkzswI53M3MCuRwNzMrkMPdzKxA/x/iAeu41OcKSwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.random.randint(0, 1000, size=20)\n",
    "\n",
    "means = []\n",
    "for _ in range(1000):\n",
    "    x_sample = np.random.choice(x, size=50, replace=True)\n",
    "    means.append(x_sample.mean())\n",
    "    \n",
    "plt.hist(means)\n",
    "plt.title('Гистрограмма распределения средних значений')\n",
    "plt.xlabel('S_mean')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Задание 5¶\n",
    "\n",
    "Найдите собственные значения и собственные вектора матрицы (на python и на бумаге):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 4]\n",
      " [1 1]]\n"
     ]
    }
   ],
   "source": [
    "m = np.array([[1, 4],\n",
    "              [1, 1]])\n",
    "print(m)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1) Письменное решение\n",
    "\n",
    "$\n",
    "\\begin{vmatrix} \n",
    "    1-\\lambda & 4 \\\\\n",
    "    1 & 1-\\lambda\n",
    "\\end{vmatrix} = 0\n",
    "$\n",
    "\n",
    "$ det = (1-\\lambda)*(1-\\lambda) - 4 = 0 \\\\ \n",
    "\\lambda^2 - 2\\lambda - 3 = 0 \\\\\n",
    "D = 4^2 + 12 = 16 \\\\\n",
    "\\lambda_1 = \\frac{2+4}{2} = 3 \\\\\n",
    "\\lambda_2 = \\frac{2-4}{2} = -1 \\\\\n",
    "$\n",
    "\n",
    "Найдем вектор для $\\lambda_1$. Для этого решим систему уравнений:\n",
    "\n",
    "$ -2x +4y = 0 \\\\ x -2y = 0$\n",
    "\n",
    "Из системы уравнений вытекает следующее: $x = 2y$  \n",
    "Тогда собственный вектор для $\\lambda_1$: [2, 1]\n",
    "\n",
    "Найдем вектор для $\\lambda_2$. Для этого решим систему уравнений:\n",
    "\n",
    "$ 2x +4y = 0 \\\\ x + 2y = 0$\n",
    "\n",
    "Из системы уравнений вытекает следующее: $x = -2y$  \n",
    "Тогда собственный вектор для $\\lambda_2$: [2, -1]\n",
    "\n",
    "2) Решение в python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([ 3., -1.]),\n",
       " array([[ 0.89442719, -0.89442719],\n",
       "        [ 0.4472136 ,  0.4472136 ]]))"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.linalg.eig(m)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
